package com.gx.smart.building.ui.common.util;

import com.blankj.utilcode.util.SPUtils;
import com.gx.smart.common.util.AppConfig;

/**
 * @author: xiaosy
 * 时间: 2022/9/8
 * @Description: app 用户信息保存
 * @Version: 1.0
 **/
public class AppUserInfoUtil {
    /**
     * @param phone
     * @param token
     */
    public static void saveLogin(String phone, String token) {
        SPUtils.getInstance().put(AppConfig.LOGIN_ACCOUNT, phone);
        SPUtils.getInstance().put(AppConfig.LOGIN_TOKEN, token);
    }


    public static void saveAppLogin(String id, String userId, String userName) {
        SPUtils.getInstance().put(AppConfig.ID, id);
        SPUtils.getInstance().put(AppConfig.USER_ID, userId);
        SPUtils.getInstance().put(AppConfig.USER_NAME, userName);
    }

    public static void clearLogin() {
        SPUtils.getInstance().remove(AppConfig.LOGIN_PASSWORD);
        SPUtils.getInstance().remove(AppConfig.LOGIN_TOKEN);
    }


    public static void clearAppLogin() {
        SPUtils.getInstance().remove(AppConfig.ID);
        SPUtils.getInstance().remove(AppConfig.USER_ID);
        SPUtils.getInstance().remove(AppConfig.USER_NAME);
    }
}
